def sum_numbers(num1: float, num2: float, num3: float, num4: float) -> float:
    """
    传入4个键盘输入的数字，并求和。返回打印
    :param num1:
    :param num2:
    :param num3:
    :param num4:
    :return:
    """
    return num1 + num2 + num3 + num4


def sum_list(nums: list) -> float:
    """
    传入一个列表，并求出列表的总和
    :param nums:
    :return:
    """
    sum_number = 0
    for num in nums:
        if type(num) is float or type(num) is int:
            sum_number += num
        else:
            print('请传入数字列表')
    return sum_number


def print_multiplication_table():
    """
    打印99乘法表
    :return:
    """
    for i in range(0, 10):
        for j in range(1, i + 1):
            print(f'{i} x {j} = {i * j}\t', end='')
        print()


def print_multiple_table_n(num: int):
    """
    传入一个数字N，然后打印NxN的乘法表
    :param num:
    :return:
    """
    for i in range(0, num + 1):
        for j in range(1, i + 1):
            print(f'{i} x {j} = {i * j}\t', end='')
        print()


def return_number(list_number: list, index: int) -> int:
    """
    接收一个列表和一个数字，返回这个列表中对应数字的数据，如果数字超出列表长度范围，返回-1
    :param list_number:
    :param index:
    :return:
    """
    if index >= len(list_number):
        return -1
    return list_number[index]


def sum_number(num: int) -> int:
    """
    使用方法的递归，求1~300所有数的和
    :param num:
    :return:
    """
    if num == 1:
        return num
    else:
        return num + sum_number(num - 1)


def print_table_num_fall(num: int):
    """
    NxN的乘法表的倒叙打印
    :param num:
    :return:
    """
    for i in range(num, 0, -1):
        for j in range(1, i + 1):
            print(f'{j} x {i} = {i * j}\t', end='')
        print()
